export const CONFIG_KEY = "app-config";
// 默认配置
const defaultConfig = {
	theme: "light"
};

export function getConfig() {
	return JSON.parse(localStorage.getItem(CONFIG_KEY) || JSON.stringify(defaultConfig));
}
export function setConfig(conf) {
	const config = JSON.parse(localStorage.getItem(CONFIG_KEY) || JSON.stringify(defaultConfig));

	console.log("config1", config);

	Object.keys(conf).forEach(key => {
		config[key] = conf[key];
	});

	console.log("config2", config);

	localStorage.setItem(CONFIG_KEY, JSON.stringify(config));
}
